<template>
    <div>
        <div style="margin: 20px 5px 10px 5px;padding: 5px;">
            <el-button type="success" icon="el-icon-plus" @click="openWindow('studentChild')">新增学生</el-button>
        </div>
        <div style="margin: 5px;padding: 5px;">
            <el-table :data="studentList" size="mini" v-loading="loading" :height="550" highlight-current-row>
                <el-table-column type="index" align="center"></el-table-column>
                <el-table-column align="center" prop="nickName" label="姓名" show-overflow-tooltip></el-table-column>
                <el-table-column align="center" label="所在班级" prop="classesName" show-overflow-tooltip sortable></el-table-column>
            </el-table>
        </div>
        <student-child ref="studentChild"></student-child>
    </div>
</template>

<script>

    import { getStudentList } from "@/api/quality/student";

    export default {
        name: "student-index",
        components:{
            StudentChild:()=>import("@/views/quality/student-child.vue")
        },
        data(){
            return {
                loading:true,
                studentList:[]
            }
        },
        methods:{
            openWindow(name){
                this.$refs[name].student = {};
                this.$refs[name].value = true;
            },
            getStudentList(data){
                getStudentList(data).then(res=>{
                    this.studentList = res.data.data;
                    this.loading = false;
                })
            }
        },
        created(){
            this.getStudentList({});
        }
    }
</script>

<style scoped>

</style>